    always @(*) begin
		if (rst == `RST)
			csr_rd_data = `ZERO_WORD;
		else if (csr_rd_ena == 1'b1)
			case (csr_addr) 
                `MSTATUS  : csr_rd_data   =   csr_mstatus;
                `MIE      : csr_rd_data   =   csr_mie;
                `MEPC     : csr_rd_data   =   csr_mepc;
                `MCAUSE   : csr_rd_data   =   csr_mcause;
                `MTVAL    : csr_rd_data   =   csr_mtval;
                `MIP      : csr_rd_data   =   csr_mip;
                `MCYCLE   : csr_rd_data   =   csr_mcycle;
                `MINSTRET : csr_rd_data   =   csr_minstret;
                default   : csr_rd_data   =   `ZERO_WORD;
            endcase
		else
			csr_rd_data = `ZERO_WORD;
	end

    //为了满足difftest下时钟沿采样的改进，流水线时将会优化掉
        always @(*) begin
		if (rst == `RST)
        begin
            mstatus_o    =  `ZERO_WORD;
            mie_o        =  `ZERO_WORD;
            mepc_o       =  `ZERO_WORD;
            mcause_o     =  `ZERO_WORD;
            mtval_o      =  `ZERO_WORD;
            mip_o        =  `ZERO_WORD;
            mcycle_o     =  `ZERO_WORD;
            minstret_o   =  `ZERO_WORD; 
        end
        else if(csr_wr_ena)
        begin
            case(csr_addr)
                `MSTATUS  : 
                    begin 
                        mstatus_o    =  csr_wr_data;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MIE      : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_wr_data;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MEPC     : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_wr_data;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MCAUSE   : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_wr_data;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MTVAL    : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_wr_data;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MIP      :
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_wr_data;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_minstret; 
                    end
                `MCYCLE   : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_wr_data;
                        minstret_o   =  csr_minstret; 
                    end
                `MINSTRET : 
                    begin 
                        mstatus_o    =  csr_mstatus;
                        mie_o        =  csr_mie;
                        mepc_o       =  csr_mepc;
                        mcause_o     =  csr_mcause;
                        mtval_o      =  csr_mtval;
                        mip_o        =  csr_mip;
                        mcycle_o     =  csr_mcycle;
                        minstret_o   =  csr_wr_data; 
                    end
                default   : 
                    begin 
                        mstatus_o    =  mstatus_o;
                        mie_o        =  mie_o;
                        mepc_o       =  mepc_o;
                        mcause_o     =  mcause_o;
                        mtval_o      =  mtval_o;
                        mip_o        =  mip_o;
                        mcycle_o     =  mcycle_o;
                        minstret_o   =  minstret_o; 
         
                    end
            endcase
        end
        else
        begin 
                        mstatus_o    =  mstatus_o;
                        mie_o        =  mie_o;
                        mepc_o       =  mepc_o;
                        mcause_o     =  mcause_o;
                        mtval_o      =  mtval_o;
                        mip_o        =  mip_o;
                        mcycle_o     =  mcycle_o;
                        minstret_o   =  minstret_o; 
        end
    end
       
      

endmodule